package com.example.jdk21;

import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;

public class SwitchTest {
    private static final Logger log = Logger.getLogger(SwitchTest.class.getName());
    public static void main(String[] args) {
        Map<String, Object> data = new HashMap<>();
        data.put("key1", "aaa");
        data.put("key2", 111);
        if (data.get("key1") instanceof String s) {
            log.info(s);
        }

        if (data.get("key") instanceof String s) {
            log.info(s);
        } else if (data.get("key") instanceof Double s) {
            log.info(s.toString());
        } else if (data.get("key") instanceof Integer s) {
            log.info(s.toString());
        }

        switch (data.get("key1")) {
            case String s  -> log.info(s);
            case Double d  -> log.info(d.toString());
            case Integer i -> log.info(i.toString());
            default        -> log.info("");
        }


    }
}
